home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
asmutil
/
uasm.zip
/
U-ASM.DOC
< prev
next >
Wrap
Text File
|
1986-04-10
|
22KB
|
629 lines
.R:Q
.H:
.H:
.H:...UASM - Universal Cross Assembler...
.H:
.F:
.F:...Custom Computer Consultants $$$ 10 April 1986...
.F:
UASM - Universal Cross Assembler
8051
6805
Z8
10 April 1986
1. INTRODUCTION
General Description
UASM is a program which facilitates the writing of assemblers for single
chip microcomputers. It has only the rudimentary features of decoding the
instruction set and a few pseudo operations. It is intended for programs
that can be contained in a single file which is typical of the short
programs written for these types of processors. In particular there are no
provisions for macros or include files. The performance when generating
both an object file and a listing is about 700 statements per minute when
using a hard disk.
Program Execution
UASM has several different names depending on which processor it has been
built for. It is invoked by entering the name of the program ( asm05 for
the 6805 version) followed by the name of the source file followed by the
option switches. The allowable options are at the present time are :
o creates an object output file from the name of the source file
and the extension ".HEX".
l creates a listing file from the name of the source file and the
extension ".LST".
n suppress the listing function.
If the l and the n options are both absent then the listing goes to the
terminal. If no source file is specified then the input is taken from the
terminal and ouput is written to the terminal. The assembler is entered
directly into pass 2 with no symbol table. This feature was mainly used
for program debugging and has not been removed.
Program Operation
UASM is a two pass assembler. On the first pass it reads statements from
the input file and builds a symbol table. On the second pass it reads the
statements from the input file and creates the object output file and the
listing file using the symbol table information it created in the first
pass. At the end of the listing file the content of the symbol table is
added. The object ouput is in Intel Hex format with a maximum of 34 bytes
to a record. When displayed on an 80 column screen the records will
exactly fill on line. The listing file is formatted with 55 statement
lines and four header lines per page and assumes 11 inch pages and 6 lines
per inch. This leaves a combined top and bottom margin of seven lines.
Files
The UASM system was written in the C language and consists of the following
set of files :
STDIO.H Standard I/O Header File
UASM.H UASM header file; same for all versions
UASM.C Source code for the part common to all the
versions.
51SYM.C Symbols and processing routines for the 8051.
6805SYM.C Symbols and processing routines for the 6805.
Z8SYM.C Symbols and processing routines for the Z8.
ASM51.EXE 8051 assembler execution file.
ASM05.EXE 6805 assembler execution file.
ASMZ8.EXE Z8 assembler execution file.
51VAL.MAC 8051 validation/example file.
6805VAL.MAC 6805 validation/example file.
Z8VAL.MAC Z8 validation/example file.
U-ASM.DOC This File
2. Assembler Conventions
Statement Format
The primary component in an assembly language program is the statement,
which consists of an instruction and its operands. The instruction
specifies and action to be taken and the operands specify the data to be
acted upon. An assembly language statement can include four fields:
Statement Labels
Instructions or Pseudo Operations
Operands
Comments
The statement label and comments are optional. The statement may have zero
or more operands depending on the instruction. The fields in a statement
are separated from each other by one or more delimiters. Delimiters
include spaces, tabs, commas, semi-colons, colons, newlines. To accomodate
various programming styles the rules on delimiters are very relaxed. In
general blanks separate fields and commas separate operands. Colons after
labels are optional and delimiters for the comment field are also optional.
This can lead to problems with evaluating expressions if the first word in
a comment happens to be a recognizeable symbol. Therefore use of a comment
delimiter (";") is strongly recommended. Comments may occupy an entire
line when the first character is either a semi-colon (";") or an asterisk
("*").
Program Labels and Identifiers
A program label is any identifier that begins in the first position of a
line. An identifier is any string of alphanumeric characters whose first
character is alphabetic. A program label may be followed by an optional
colon. A character is alphbetic if it is either upper case or lower case.
A character is alphanumeric if it is either alphabetic or numeric or
underscore.
upper case = { A B C D E F G H I J K L M N O P Q R S T U V W X Y Z }
lower case = { a b c d e f g h i j k l m n o p q r s t u v w x y z }
numeric = { 0 1 2 3 4 5 6 7 8 9 }
alphabetic = { upper case } or { lower case }
alphanumeric = { alphabetic } or { numeric } or { _ }
identifier = { alphabetic } followed by one or more { alphanumeric }
program label = identifier in first position of a line
Each time an identifier is used it must be written in exactly the same way
or it will be considered a different identifier. Identifiers may be any
length but only 31 characters are significant. The following are valid and
unique identifiers:
begin BEGIN bEgIn
label12 LABEL12 lAbEl12
group1: GROUP1: gRoUp1:
In addition to their statement labeling function identifiers also represent
constants and variable names. They may even define a value for the symbols
which represent instructions and pseudo operations, and no conflict will
result.
Instructions
The instruction field contains a mnemonic symbol which specifies one of the
processors instructions or a pseudo operation. A pseudo operation is an
instruction to the assembler to perform some action. Instructions must be
preceeded and followed by one or more spaces to separate them from the
label and operand fields. Pseudo operations are described in the
appendicies
Operands
Depending on the instruction there can be zero, one or more operands.
Multiple operands are separated from each other by commas. Operands supply
the information the instruction needs to carry out its operation. An
operand can be :
Immediate data
The address of a location from which data is to be taken